(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
"use strict";

loader.define({
  depend: ['pages/config/config'],
  loaded: function loaded(config, require, exports, module, global) {
    var pageview = {};
    var citySelect = null;
    var personlocation = "";
    var personimage = "";
    var screenWidth = window.screen.width; // 拍照上传

    var $facePhoto = $("#buiPhoto");
    this.pageview = {
      init: function init(e) {
        //初始化页面的动态渲染
        var height = $("#home").height();
        var width = $("#home").width(); //mine_my_big

        $("#mine_my_big").css({
          "height": "25%",
          "marginTop": height * 0.025
        }); //mine_my_big_part1

        $("#mine_my_big_part1").css({
          "height": height * 0.25 * 0.4,
          "marginTop": height * 0.25 * 0.1
        });
        var set_width = $("#mine_my_big_part1 img").height();
        set_width = set_width.toString() + "px";
        $("#mine_my_big_part1 img").attr("width", set_width); //mine_my_big_part2

        $("#mine_my_big_part2").css({
          "height": height * 0.25 * 0.4,
          "width": width * 0.9 - height * 0.25 * 0.4 - width * 0.9 * 0.05 * 2 - 6,
          "marginTop": height * 0.25 * 0.1
        });
        $("#mine_my_big_part2_div1").css({
          "height": height * 0.25 * 0.4 * 0.5
        });
        var p_height = $("#mine_my_big_part2_div1 p").height();
        $("#mine_my_big_part2_div1 p").css({
          "marginTop": height * 0.25 * 0.4 * 0.5 - p_height,
          "marginBottom": 0
        });
        $("#mine_my_big_part2_div1 img").css({
          "height": p_height,
          "width": p_height,
          "marginTop": height * 0.25 * 0.4 * 0.5 - p_height,
          "marginLeft": "10%"
        });
        $("#mine_my_big_part2_div2").css({
          "height": height * 0.25 * 0.4 * 0.5,
          "marginTop": height * 0.25 * 0.4 * 0.1
        }); //mine_my_big_part3

        $("#mine_my_big_part3").css({
          "height": height * 0.25 * 0.3,
          "marginTop": height * 0.25 * 0.05
        });
        $("#mine_my_big_part3 img").css({
          "height": height * 0.25 * 0.3 * 0.65,
          "width": height * 0.25 * 0.3 * 0.65,
          "marginLeft": width * 0.9 * 0.025
        }); //mine_my_big_part4

        $("#mine_my_big_part4").css({
          "height": height * 0.25 * 0.3,
          "marginTop": height * 0.25 * 0.05
        }); //mine_my_big_part5

        $("#mine_my_big_part5").css({
          "height": height * 0.25 * 0.3,
          "marginTop": height * 0.25 * 0.05
        });
        $("#mine_my_big_part5 div").css({
          "padding": "0 .2rem",
          "marginRight": width * 0.9 * 0.35 * 0.1
        }); //mine_my_collection

        $("#mine_my_collection").css({
          "marginTop": height * 0.025
        });
        $("#mine_my_collection #p1").css({
          "lineHeight": (height * 0.125 * 0.5).toString() + "px"
        }); //mine_my_activity

        $("#mine_my_activity").css({
          "marginTop": height * 0.025
        });
        $("#mine_my_activity #p3").css({
          "lineHeight": (height * 0.125 * 0.5).toString() + "px"
        }); // var dataurl;
        // var getParams = bui.getPageParams();
        // getParams.done(function(result){
        // 	dataurl= result['dataurl'];
        // 	console.log("2:    "+dataurl);
        // 	$uploadBtn.html(templatePhoto(dataurl))
        // 	//console.log(url);      
        // })

        var $uploadBtn = $("#mine_my_big_part1");
        $("#mine_my_big_part2").click(function () {
          bui.load({
            url: "pages/personalcontent/personalcontent",
            param: {
              flag: "2",
              personlocation: $("#mine_my_big_part2_div1").attr('value')
            }
          });
        });
        $("#mine_my_collection").click(function () {
          bui.load({
            url: "pages/mycollectactivity/mycollectactivity"
          });
        });
        $("#mine_my_activity").click(function () {
          bui.load({
            url: "pages/myjoinactivity/myjoinactivity"
          });
        });
        bui.ajax({
          url: config.apiurl + "api/v1.0/mychange",
          data: {},
          method: "post",
          headers: {
            'Content-Type': 'application/json'
          }
        }).done(function (res) {
          //console.log(res);
          $("#mine_my_big_part2_div1").text(res['name']);
          $("#p1").text(res['staracts']);
          $("#p3").text(res['acts']);
          personlocation = res['loc'];

          if (personlocation == null) {
            personlocation = "";
          }

          $("#mine_my_big_part2_div1").attr('value', personlocation);
          personimage = res['avatar_url'];
          console.log(personimage);
          personimage = personimage + "?temp=" + Date.now(); //在src后面增加一个随机数避免图片无法更新
          //console.log(personimage);

          $uploadBtn.html(templatePhoto(personimage));
        }).fail(function (res, status) {
          console.log(status); // status = "timeout" || "error" || "abort", "parsererror"
        }); // $("#mine_my_big_part1").click(function(){
        // 	bui.load({url:"pages/test/test",
        // })
        // });

        $("#mine_quit").click(function () {
          bui.ajax({
            url: config.apiurl + "api/v1.0/logout",
            method: "DELETE",
            headers: {
              'Content-Type': 'application/json'
            }
          }).then(function (res) {
            console.log(res);
            config.bs.logout();
            bui.hint({
              content: "<i class='icon-check'></i><br />退出成功",
              position: "center",
              effect: "fadeInDown"
            });
            bui.load({
              url: "pages/main/main"
            });
          }, function (res, status) {
            console.log(status);
          });
        });
        var uiUpload = bui.upload({
          showProgress: true // needNative: false

        }); // 上拉菜单 js 初始化:

        var uiActionsheet = bui.actionsheet({
          trigger: "#mine_my_big_part1",
          appendTo: "#home",
          buttons: [{
            name: "查看头像",
            value: "check"
          }, {
            name: "更改头像",
            value: "photo"
          }],
          callback: function callback(e) {
            var ui = this;
            var val = $(e.target).attr("value");

            switch (val) {
              // case "camera":
              // 	ui.hide();
              // 	uiUpload.add({
              // 		"from": "camera",
              // 		 //"needCompress": true, // 1.5.3新增压缩
              // 		// "width": 300,
              // 		"destinationType": "file", //  file | blob | data 
              // 		"onSuccess": function(val, data) {
              // 			// bui.alert(val)
              // 			this.toBase64({
              // 				onSuccess: function(url) {
              // 					bui.load({
              // 						url:"pages/clip/clip",
              // 						param:{
              // 							url:url
              // 						}
              // 					});
              // 				},
              // 				onFail: function(url) {
              // 					bui.alert(url)
              // 						// $uploadBtn.before(templatePhoto(url))
              // 				}
              // 			});
              // 		}
              // 	})
              // 	break;
              case "photo":
                ui.hide();
                uiUpload.add({
                  "from": "",
                  "needCompress": true,
                  // 1.5.3新增压缩
                  "onSuccess": function onSuccess(val, data) {
                    // 展示base64本地图片 建议直接调用start方法上传以后再展示远程地址,避免应用崩溃
                    this.toBase64({
                      onSuccess: function onSuccess(url) {
                        bui.load({
                          url: "pages/clip/clip",
                          param: {
                            url: url
                          }
                        });
                      }
                    });
                  }
                });
                break;

              case "check":
                ui.hide();
                bui.ajax({
                  url: config.apiurl + "api/v1.0/mychange",
                  data: {},
                  method: "post",
                  headers: {
                    'Content-Type': 'application/json'
                  }
                }).done(function (res) {
                  //console.log(res);
                  personimage = res['avatar_url'];
                  personimage = personimage + "?temp=" + Date.now(); //在src后面增加一个随机数避免图片无法更新

                  checkphoto1(personimage);
                }).fail(function (res, status) {
                  console.log(status); // status = "timeout" || "error" || "abort", "parsererror"
                });
                break;

              case "cancel":
                ui.hide();
                break;
            }
          }
        });

        function templatePhoto(url) {
          return "<img src=\"".concat(url, "\" height=\"100%\" />");
        }
      }
    };

    this.pageview.refresh = function () {
      location.reload();
    };

    this.pageview.init();
    return this.pageview;
  }
});
},{}]},{},[1]);
